package com.myhome.controller;

import com.myhome.config.constant.R;
import com.myhome.domain.Account;
import com.myhome.service.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author QYiXin
 * @Date 2021 10 23 22 37
 **/
@RestController
@RequestMapping("/account")
@Api(tags = "账户控制器")
public class AccountController {
    @Autowired
    AccountService accountService;
    @GetMapping("/{coinName}")
    @ApiOperation(value = "获取当前用户的货币的资产情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "coinName", value = "货币的名称")
    })
    public R<Account> getAccount(@PathVariable("coinName") String coinName) {
        Account result = accountService.getAccountByCoinName(coinName);
        return R.ok(result);
    }
}
